<?php

require_once("rpcl/rpcl.inc.php");
//Includes
use_unit("webservices.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
require_once("DBX.php");
/*
* Returns the input
*/
//$head='<!--'.date("d M Y h:i:s:m A").' - '.$_SERVER['HTTP_USER_AGENT'].'-->';
//$foot='<!-- post size:'.$_SERVER['CONTENT_LENGTH'].'-->';
//$xml = file_get_contents('php://input');

//session_id()

$dsd=Logger(1,date("d M Y h:i:s:m A"),$_SERVER['HTTP_USER_AGENT'],$_SERVER['CONTENT_LENGTH'],file_get_contents('php://input'),"");
          $handel=fopen("caca.php","a");
          fwrite( $handel,$dsd);
          fclose($handel);



function serviceEcho($input)
{
   return($input);
}

function Acc_Auth($user,$pass)
{
   return User_Auth($user,$pass);
}

function Send_Php($acc_id,$token,$code)
{
   return EndPoint_Php($acc_id,$token,$code);
}

/*
* Converts the input array, which are strings, to an array of integers
*/
function StringArrayToIntArray($inputarray)
{
   $result = array();
   reset($inputarray);
   while(list($key, $val) = each($inputarray))
   {
      $result[] = (int)$val;
   }

   return($result);
}

//Class definition
class phpSoapServer extends DataModule
{
   public $IphpWS = null;
   function IphpWSAddComplexTypes($sender, $params)
   {
      //Add the complex type array of strings
      $this->IphpWS->addComplexType
      (
      'ArrayOfstring',
      'complexType',
      'array',
      '',
      'SOAP-ENC:Array',
      array(),
      array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'string[]')),
      'xsd:string'
      );

      //Add the complex type array of integers
      $this->IphpWS->addComplexType
      (
      'ArrayOfinteger',
      'complexType',
      'array',
      '',
      'SOAP-ENC:Array',
      array(),
      array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'integer[]')),
      'xsd:integer'
      );
   }

   function IphpWSRegisterServices($sender, $params)
   {
      //Register the echo service
      $this->IphpWS->register(
      "serviceEcho",
      array('input' => 'xsd:string'),
      array('return' => 'xsd:string'),
      'http://localhost/'
      );

      $this->IphpWS->register(
      "Acc_Auth",
      array('user' => 'xsd:string','pass' => 'xsd:string'),
      array('return' => 'xsd:string'),
      'http://localhost/'
      );

       $this->IphpWS->register(
      "Send_Php",
      array('acc_id' => 'xsd:string','token' => 'xsd:string','code' => 'xsd:string'),
      array('return' => 'xsd:string'),
      'http://localhost/'
      );
      //Register the conversion service


   }
}

global $application;

global $phpSoapServer;

//Creates the form
$phpSoapServer = new phpSoapServer($application);

//Read from resource file
$phpSoapServer->loadResource(__FILE__);

?>
